#include <iostream>
#include <stdio.h>
#include "queue.hpp"

#define TEST_SIZE 512
using namespace std;

int main( int argc, char** argv)
{
	Queue A;

	for ( int i = 1; i < TEST_SIZE ; i++)
	{
		if ( !A.add( i))
		{
			printf("Queue is full");
		}
	}
	
	for ( int i = 1; i < TEST_SIZE + 2; i++)
	{
		Queue_elem_type tmp;
		if ( A.get( &tmp))
		{
			if ( i != tmp)
			{
				printf("Elem[ %d] = %d\n, but should be %d",i,tmp,i);
				printf("\n!!!TEST FAILED\n");
				return 0;
			}
		}
		else
		{	
			if ( ( A.size() == 0))
			{
				//printf("Queue is empty\n");
			}
			else
			{
				printf("Queue isn't empy, but .get( ) have returned false");
				printf("\n!!!TEST FAILED\n");
				return 0;
			}
		}
	}
	
	A.del();
	if ( (A.size() != 0)  )
	{
		printf("Queue isn't empty after .del()");
		printf("\n!!!TEST FAILED\n");
		return 0;
	}
	
	printf("\n!!!TEST PASSED\n");
	return 0;
	
	
	
	
	
}